<% layout('/layout/default.html', {title: '树结构表生成', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="card-header">
		<i class="fa fa-sitemap"></i> 树结构表生成
		<div class="header-tools float-right">
			<a href="#" class="btn btn-default btn-sm " id="btnRefreshTree" title="刷新"><i class="fa fa-refresh"></i> 刷新</a>
			<a href="#" class="btn btn-default btn-sm " id="btnExpandTreeNode" title="展开全部"><i class="fa fa-angle-double-down"></i> 展开</a>
			<a href="#" class="btn btn-default btn-sm " id="btnCollapseTreeNode" title="折叠全部"><i class="fa fa-angle-double-up"></i> 折叠</a>
			<% if(hasPermi('test:testTree:edit')){ %>
			<a href="/test/testTree/form" class="btn btn-default btn-sm btnTool" title="添加根树结构表生成"><i class="fa fa-plus"></i> 添加根树结构表生成</a>
			<% } %>
		</div>
	</div>
	<div class="container-fluid">
		<form id="searchForm" action="${ctx}/test/testTree/listData" class="form-inline d-none">
			<div class="form-group">
				<button type="submit" class="btn btn-success btn-sm ">查询</button>
				<button id="reset" type="reset" class="btn btn-default btn-sm">重置</button>
			</div>
		</form>
		<table id="dataGrid" class="table table-bordered table-hover" cellspacing="0" width="100%"></table>
	</div>
</div>
<% } %>
<script>
	$('#dataGrid').dataGrid({
		searchForm: $("#searchForm"),
		columnModel: [
			{header:'名称', name:'name', index:'a.name', width:90, align:"center"},
			{header:'更新时间', name:'updateDate', index:'a.update_date', width:90, align:"center"},
			{header:'备注信息', name:'remarks', index:'a.remarks', width:90, align:"center"},
			{header:'操作', name:'actions', width:100, sortable:false, title:false, align:"center",formatter: function(val, obj, row, act){
					var actions = [];
				<% if(hasPermi('test:testTree:edit')){ %>
						actions.push('<a href="/test/testTree/form?id='+row.id+'" class="btnList" title="修改树结构表生成"><i class="fas fa-pencil-alt"></i></a>');
						actions.push('<a href="${ctx}/test/testTree/delete?id='+row.id+'" class="btnList" title="删除树结构表生成" data-confirm="要删除该树结构表生成及所有子树结构表生成吗？"><i class="far fa-trash-alt"></i></a>');
						actions.push('<a href="/test/testTree/form?parentId='+row.id+'" class="btnList" title="添加下级树结构表生成"><i class="fa fa-plus-square"></i></a>');
					<% } %>
					return actions.join('');
				}}
		],
		treeGrid: true,
		defaultExpandLevel: 0,
		expandNodeClearPostData: 'name',
		treeIcons : {
			plus: "ui-icon-circlesmall-plus",
			minus: "ui-icon-circlesmall-minus",
			leaf : "ui-icon-document"
		},
		// 加载成功后执行事件
		ajaxSuccess: function(data){

		}
	});
</script>